home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr22 / statl411.zip / MEMCLEAR.ASM < prev    next >
Assembly Source File  |  1993-05-02  |  2KB  |  137 lines

  1.         page
  2.         page ,132
  3.         title MEMCLEAR device driver - wipes clear unused memory.
  4.  
  5.         ; Written by Jac Goudsmit
  6.         ; Weegbree 101, 5684 JC Best, The Netherlands.
  7.         ; Version 1.00    30 Sep 1990
  8.         ; Version 1.01    12 Dec 1990
  9.  
  10.         .radix 16
  11.         .model small,c
  12.         .code
  13.         dd -1
  14.         dw 8000
  15.         dw offset strat
  16.         dw offset intr
  17.         db 'MEMCLEAR'
  18.  
  19. txt        db 0Dh,'MEMCLEAR V1.01 (C) Jac Goudsmit 12 Dec 1990.',0Dh,0A
  20.         db 'Wipes clear all unused memory.',0Dh,0A,24,8,20,1A
  21. end_txt     db '    ',0Dh,0A,24
  22. bxs        dw ?
  23. ess        dw ?
  24.  
  25. Strat:        mov cs:bxs,bx
  26.         mov cs:ess,es
  27.         retf
  28.  
  29. Intr:        push ax
  30.         push bx
  31.         push cx
  32.         push dx
  33.         push si
  34.         push di
  35.         push ds
  36.         push es
  37.         cld
  38.         cli
  39.         mov dx,offset txt
  40.         push cs
  41.         pop ds
  42.         mov ah,9
  43.         int 21
  44.  
  45.         mov ax,cs
  46.         add ax,1000
  47.         and ax,0F000
  48.         mov bx,ss
  49.         and bx,0F000
  50.  
  51. @@:        mov es,ax
  52.         xor di,di
  53.         cmp ax,bx
  54.         je stackseg
  55.         cmp ax,9000
  56.         jae memend
  57.  
  58.         mov cx,8000
  59.         call printax
  60.         rep stosw
  61.         add ax,1000
  62.         jmp @B
  63.  
  64. stackseg:    mov bx,ss
  65.         sub bx,ax
  66.         mov cl,3
  67.         shl bx,cl
  68.         mov cx,bx
  69.         call printax
  70.         xor bx,bx
  71.         mov ax,ss
  72.         add ax,1000
  73.         jmp @B
  74.  
  75. memend:     cmp ax,0A000
  76.         jae @F
  77.         mov bx,0A000
  78.         sub bx,ax
  79.         mov cl,3
  80.         shl bx,cl
  81.         mov cx,bx
  82.         call printax
  83.         rep stosw
  84.  
  85. @@:        mov dx,offset end_txt
  86.         push cs
  87.         pop ds
  88.         mov ah,9
  89.         int 21
  90.  
  91.         sti
  92.         les bx,dword ptr cs:bxs
  93.         mov word ptr es:[bx+3],100
  94.         mov word ptr es:[bx+0E],0
  95.         mov word ptr es:[bx+10],cs
  96.         pop es
  97.         pop ds
  98.         pop di
  99.         pop si
  100.         pop dx
  101.         pop cx
  102.         pop bx
  103.         pop ax
  104.         retf
  105.  
  106. printhex:    push ax
  107.         and al,0F
  108.         add al,90
  109.         daa
  110.         adc al,40
  111.         daa
  112.         mov dl,al
  113.         mov ah,2
  114.         int 21
  115.         pop ax
  116.         ret
  117.  
  118. printax:    push ax
  119.         push dx
  120.         push cx
  121.         mov cx,4
  122. @@:        push cx
  123.         mov cl,4
  124.         rol ax,cl
  125.         call printhex
  126.         pop cx
  127.         loop @B
  128.         mov dl,0Dh
  129.         mov ah,2
  130.         int 21
  131.         pop cx
  132.         pop dx
  133.         pop ax
  134.         ret
  135.         end 
  136. 
  137.